<style>
.tmp_pop_l{
	width:51px;
}
</style>
<div id="k_pop_box_area">
<dl style="margin:10px 10px 5px; height:22px" class="clear">
  <dt class="left alR tmp_pop_l">商&nbsp;&nbsp;&nbsp;品：</dt>
  	<dd class="left alL">
  		<php>if (isset($price)) {</php>
		  <input type="hidden" id="goods_id" value="{$price['goods_id']}" />
		  {:getGoodsTitle($price['goods_id'],'')}
		  <php>}else {</php>
		  <input type="text" id="goods_id" value="{$goods_id}">&nbsp;填&nbsp;&nbsp;ID
		  <php>}</php>
  		</dd>
  <br><br>
	<dt class="left alR tmp_pop_l">进货价：</dt>
		<dd class="left alL"><input type="text" id="in_price" value="{$price['in_price']}">&nbsp;填数字</dd>
	<br><br>
	<dt class="left alR tmp_pop_l">市场价：</dt>
		<dd class="left alL"><input type="text" id="market_price" value="{$price['market_price']}">&nbsp;填数字</dd>
	<br><br>
	<dt class="left alR tmp_pop_l">进货量：</dt>
		<dd class="left alL"><input type="text" id="total_number" value="{$price['total_number']}">&nbsp;填数字</dd>
	<br><br>
	<dt class="left alR tmp_pop_l">销售日：</dt>
		<dd class="left alL"><input type="text" id="start_time" onfocus="rcalendar(this);"
								value="{$price['start_time']|paramMillisecond2Date}" readonly>&nbsp;请选择</dd>
	<br><br>
	<dt class="left alR tmp_pop_l">截止日：</dt>
		<dd class="left alL"><input type="text" id="expire_time" onfocus="rcalendar(this);"
								value="{$price['expire_time']|paramMillisecond2Date}" readonly>&nbsp;请选择</dd>
	<br><br>
	<dt class="left alR tmp_pop_l" style="color:red;">生&nbsp;&nbsp;&nbsp;效：</dt>
		<dd class="left alL">
			<input name="enable" type="checkbox" id="enable"
							<php>if($price['enable'] == 'Y') {</php> checked = "checked" <php>}</php> 
							value="Y">
						钩选为生效
</dl>

<div class="clear"></div>
<br>
<div style="background:#F8F8F8; border-top:1px solid #E6E6E6; padding:5px;" class="alR">
  <php>if (isset($price)) {</php>
  <input type="button" class="btn_b" onclick="_edit()" value="提交" />
  <php>}else {</php>
  <input type="button" class="btn_b" onclick="_add()" value="提交" />
  <php>}</php>
  <input type="button" class="btn_w" onclick="_cancel()" value="取消" />
</div>
</div>
<script type="text/javascript">

function _edit() {
	var priceId = "{$price['id']}";
	var goods_id = $('#k_pop_box_area').find('#goods_id').val();
	var in_price = $('#k_pop_box_area').find('#in_price').val();
	var market_price = $('#k_pop_box_area').find('#market_price').val();
	var total_number = $('#k_pop_box_area').find('#total_number').val();
	var expire_time = $('#k_pop_box_area').find('#expire_time').val();
	var start_time = $('#k_pop_box_area').find('#start_time').val();
	var enable   = 'N';
	if($('#k_pop_box_area').find('#enable').attr("checked")==true){
			enable   = 'Y';
	}
	var _data = {priceId:priceId,goods_id:goods_id,in_price:in_price,market_price:market_price
								,total_number:total_number,expire_time:expire_time,start_time:start_time,enable:enable};
	var _url = "{:U('/Price/doEditPrice')}";
	$.ajax({
 			type: "POST",
 			url: _url,
 			data:   _data,
 			success: function(msg){
 										//alert(msg);
 										var obj	=	eval('(' + msg + ')');
								    if(obj.status==1){
												var url = "{:U('/Price/index',array('goods_id'=>$price['goods_id']))}";
												k_success(obj.msg);
												k_page_redirect(url);
										}else{
												alert(obj.msg);
										}
 								}
		});
}

function _cancel() {
	ui.box.close();
}
</script>
